import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import htmlPlugin from "vite-plugin-index-html";
const path = require("path");
import { resolve } from "path"; // 主要用于alias文件路径别名

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    htmlPlugin({
      input: "./src/main.ts",
      preserveEntrySignatures: "exports-only",
    }),

    
  ],
  lintOnSave: false,
  outDir: "dist",
  base: "./",
  resolve: {
    alias: {
      "@": resolve(__dirname, ".", "src"),
    },
  },
  define: {
    "process.env": {},
  },
  server: {
    cors: true, // 默认启用并允许任何源
    open: false, // 在服务器启动时自动在浏览器中打开应用程序
    port: 8290,
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:9017',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },
});
